
<template>
  <div id="centerCInfo">
    <div class="top">
      所属集团：
      <span>{{company}}</span>
    </div>
    <div class="bottom">
      <a href="javascript:;" @click="logoutbtn">退出登录</a>
    </div>
  </div>
</template>

<script>
export default {
  name: "centerCInfo",
  data() {
    return {
      company: this.$route.query.company
    };
  },
  mounted() {},
  created() {},
  methods: {
    logoutbtn(){
      var that = this
      this.$vux.confirm.show({
        title: '提示',
        content: '是否退出登录',
        onShow () {
          console.log('plugin show')
        },
        onHide () {
          console.log('plugin hide')
        },
        onCancel () {
          console.log('plugin cancel')
        },
        onConfirm () {
          console.log('plugin confirm')
          
          that.logout()
        }
      })
    },
    logout(){
      let url = this.$CONSTANT.MY.speciallogout+
        "?sessionId=" +
        this.$common.getCookie("sessionId");;
      this.$vux.loading.show({
        text: "正在退出登录"
      });
      this.$common.post(url, '', res => {
        if (res.status == 200) {
          this.$common.setCookie("sessionId", "");
          this.$common.setCookie("sessionIdspecial", "");
          localStorage.setItem('company','')
          setTimeout(() => {
            this.$vux.loading.hide();
            this.$vux.toast.show({
              text: "退出成功",
              type: ""
            });
            setTimeout(() => {
              this.$router.replace({
                path:'/password',
                query:{
                  type:'password'
                }
              });
            }, 1000);
          }, 500);
        } else {
          this.$vux.toast.show({
            text: res.msg,
            type: "warn",
            width: 'auto'
          });
        }
      });
    },
  },
  components: {}
};
</script>

<style lang="less">
#centerCInfo {
  .top {
    // margin-top: 10px;
    height: 54px;
    line-height: 54px;
    background-color: #fff;
    font-family: PingFang-SC-Medium;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid #e1e1e1;
    border-top: 1px solid #e1e1e1;
    padding: 0 10px;
    position: relative;
    top: 10px;
    span {
      float: right;
    }
  }
  .bottom {
    position: fixed;
    bottom: 41px;
    width: 100%;
    text-align: center;
    a {
      display: inline-block;
      width: 74.1%;
      height: 42px;
      line-height: 42px;
      border: 1px solid transparent;
      border-radius: 21px;
      background-color: #f02931;
      font-family: PingFang-SC-Medium;
      font-size: 17px;
      color: #fff;
      text-align: center;
      &:hover {
        background-color: #e1252c;
      }
    }
  }
}
</style>
